%
% Status : main Dynare file
%
% Warning : this file is generated automatically by Dynare
%           from model file (.mod)

tic0 = tic;
% Define global variables.
global M_ options_ oo_ estim_params_ bayestopt_ dataset_ dataset_info estimation_info ys0_ ex0_
options_ = [];
M_.fname = 'model_htm';
M_.dynare_version = '5.0';
oo_.dynare_version = '5.0';
options_.dynare_version = '5.0';
%
% Some global variables initialization
%
global_initialization;
M_.exo_names = cell(2,1);
M_.exo_names_tex = cell(2,1);
M_.exo_names_long = cell(2,1);
M_.exo_names(1) = {'eps_g1'};
M_.exo_names_tex(1) = {'eps\_g1'};
M_.exo_names_long(1) = {'eps_g1'};
M_.exo_names(2) = {'eps_g2'};
M_.exo_names_tex(2) = {'eps\_g2'};
M_.exo_names_long(2) = {'eps_g2'};
M_.endo_names = cell(36,1);
M_.endo_names_tex = cell(36,1);
M_.endo_names_long = cell(36,1);
M_.endo_names(1) = {'federalpurchases'};
M_.endo_names_tex(1) = {'federalpurchases'};
M_.endo_names_long(1) = {'federalpurchases'};
M_.endo_names(2) = {'purchases1'};
M_.endo_names_tex(2) = {'purchases1'};
M_.endo_names_long(2) = {'purchases1'};
M_.endo_names(3) = {'purchases2'};
M_.endo_names_tex(3) = {'purchases2'};
M_.endo_names_long(3) = {'purchases2'};
M_.endo_names(4) = {'avmarkup'};
M_.endo_names_tex(4) = {'avmarkup'};
M_.endo_names_long(4) = {'avmarkup'};
M_.endo_names(5) = {'g1ramey'};
M_.endo_names_tex(5) = {'g1ramey'};
M_.endo_names_long(5) = {'g1ramey'};
M_.endo_names(6) = {'g2ramey'};
M_.endo_names_tex(6) = {'g2ramey'};
M_.endo_names_long(6) = {'g2ramey'};
M_.endo_names(7) = {'mkup1'};
M_.endo_names_tex(7) = {'mkup1'};
M_.endo_names_long(7) = {'mkup1'};
M_.endo_names(8) = {'mkup2'};
M_.endo_names_tex(8) = {'mkup2'};
M_.endo_names_long(8) = {'mkup2'};
M_.endo_names(9) = {'g1'};
M_.endo_names_tex(9) = {'g1'};
M_.endo_names_long(9) = {'g1'};
M_.endo_names(10) = {'g2'};
M_.endo_names_tex(10) = {'g2'};
M_.endo_names_long(10) = {'g2'};
M_.endo_names(11) = {'y1'};
M_.endo_names_tex(11) = {'y1'};
M_.endo_names_long(11) = {'y1'};
M_.endo_names(12) = {'y2'};
M_.endo_names_tex(12) = {'y2'};
M_.endo_names_long(12) = {'y2'};
M_.endo_names(13) = {'pi1'};
M_.endo_names_tex(13) = {'pi1'};
M_.endo_names_long(13) = {'pi1'};
M_.endo_names(14) = {'pi2'};
M_.endo_names_tex(14) = {'pi2'};
M_.endo_names_long(14) = {'pi2'};
M_.endo_names(15) = {'tau'};
M_.endo_names_tex(15) = {'tau'};
M_.endo_names_long(15) = {'tau'};
M_.endo_names(16) = {'y'};
M_.endo_names_tex(16) = {'y'};
M_.endo_names_long(16) = {'y'};
M_.endo_names(17) = {'g'};
M_.endo_names_tex(17) = {'g'};
M_.endo_names_long(17) = {'g'};
M_.endo_names(18) = {'pi'};
M_.endo_names_tex(18) = {'pi'};
M_.endo_names_long(18) = {'pi'};
M_.endo_names(19) = {'i'};
M_.endo_names_tex(19) = {'i'};
M_.endo_names_long(19) = {'i'};
M_.endo_names(20) = {'c'};
M_.endo_names_tex(20) = {'c'};
M_.endo_names_long(20) = {'c'};
M_.endo_names(21) = {'ernesto'};
M_.endo_names_tex(21) = {'ernesto'};
M_.endo_names_long(21) = {'ernesto'};
M_.endo_names(22) = {'p2'};
M_.endo_names_tex(22) = {'p2'};
M_.endo_names_long(22) = {'p2'};
M_.endo_names(23) = {'ytest'};
M_.endo_names_tex(23) = {'ytest'};
M_.endo_names_long(23) = {'ytest'};
M_.endo_names(24) = {'realrate'};
M_.endo_names_tex(24) = {'realrate'};
M_.endo_names_long(24) = {'realrate'};
M_.endo_names(25) = {'c_output'};
M_.endo_names_tex(25) = {'c\_output'};
M_.endo_names_long(25) = {'c_output'};
M_.endo_names(26) = {'g_output'};
M_.endo_names_tex(26) = {'g\_output'};
M_.endo_names_long(26) = {'g_output'};
M_.endo_names(27) = {'pi_c'};
M_.endo_names_tex(27) = {'pi\_c'};
M_.endo_names_long(27) = {'pi_c'};
M_.endo_names(28) = {'i_ann'};
M_.endo_names_tex(28) = {'i\_ann'};
M_.endo_names_long(28) = {'i_ann'};
M_.endo_names(29) = {'eeh1'};
M_.endo_names_tex(29) = {'eeh1'};
M_.endo_names_long(29) = {'eeh1'};
M_.endo_names(30) = {'eeh2'};
M_.endo_names_tex(30) = {'eeh2'};
M_.endo_names_long(30) = {'eeh2'};
M_.endo_names(31) = {'eehT'};
M_.endo_names_tex(31) = {'eehT'};
M_.endo_names_long(31) = {'eehT'};
M_.endo_names(32) = {'db'};
M_.endo_names_tex(32) = {'db'};
M_.endo_names_long(32) = {'db'};
M_.endo_names(33) = {'dtaxh'};
M_.endo_names_tex(33) = {'dtaxh'};
M_.endo_names_long(33) = {'dtaxh'};
M_.endo_names(34) = {'pi_g'};
M_.endo_names_tex(34) = {'pi\_g'};
M_.endo_names_long(34) = {'pi_g'};
M_.endo_names(35) = {'pi1_g'};
M_.endo_names_tex(35) = {'pi1\_g'};
M_.endo_names_long(35) = {'pi1_g'};
M_.endo_names(36) = {'pi2_g'};
M_.endo_names_tex(36) = {'pi2\_g'};
M_.endo_names_long(36) = {'pi2_g'};
M_.endo_partitions = struct();
M_.param_names = cell(24,1);
M_.param_names_tex = cell(24,1);
M_.param_names_long = cell(24,1);
M_.param_names(1) = {'n'};
M_.param_names_tex(1) = {'n'};
M_.param_names_long(1) = {'n'};
M_.param_names(2) = {'gy'};
M_.param_names_tex(2) = {'gy'};
M_.param_names_long(2) = {'gy'};
M_.param_names(3) = {'zeta'};
M_.param_names_tex(3) = {'zeta'};
M_.param_names_long(3) = {'zeta'};
M_.param_names(4) = {'gamma'};
M_.param_names_tex(4) = {'gamma'};
M_.param_names_long(4) = {'gamma'};
M_.param_names(5) = {'rho_g1'};
M_.param_names_tex(5) = {'rho\_g1'};
M_.param_names_long(5) = {'rho_g1'};
M_.param_names(6) = {'rho_g2'};
M_.param_names_tex(6) = {'rho\_g2'};
M_.param_names_long(6) = {'rho_g2'};
M_.param_names(7) = {'sigma'};
M_.param_names_tex(7) = {'sigma'};
M_.param_names_long(7) = {'sigma'};
M_.param_names(8) = {'varphi'};
M_.param_names_tex(8) = {'varphi'};
M_.param_names_long(8) = {'varphi'};
M_.param_names(9) = {'beta'};
M_.param_names_tex(9) = {'beta'};
M_.param_names_long(9) = {'beta'};
M_.param_names(10) = {'phi_pi'};
M_.param_names_tex(10) = {'phi\_pi'};
M_.param_names_long(10) = {'phi_pi'};
M_.param_names(11) = {'alpha1'};
M_.param_names_tex(11) = {'alpha1'};
M_.param_names_long(11) = {'alpha1'};
M_.param_names(12) = {'alpha2'};
M_.param_names_tex(12) = {'alpha2'};
M_.param_names_long(12) = {'alpha2'};
M_.param_names(13) = {'eta'};
M_.param_names_tex(13) = {'eta'};
M_.param_names_long(13) = {'eta'};
M_.param_names(14) = {'taylor'};
M_.param_names_tex(14) = {'taylor'};
M_.param_names_long(14) = {'taylor'};
M_.param_names(15) = {'share'};
M_.param_names_tex(15) = {'share'};
M_.param_names_long(15) = {'share'};
M_.param_names(16) = {'mu'};
M_.param_names_tex(16) = {'mu'};
M_.param_names_long(16) = {'mu'};
M_.param_names(17) = {'phi_b'};
M_.param_names_tex(17) = {'phi\_b'};
M_.param_names_long(17) = {'phi_b'};
M_.param_names(18) = {'phi_g'};
M_.param_names_tex(18) = {'phi\_g'};
M_.param_names_long(18) = {'phi_g'};
M_.param_names(19) = {'a3'};
M_.param_names_tex(19) = {'a3'};
M_.param_names_long(19) = {'a3'};
M_.param_names(20) = {'aux'};
M_.param_names_tex(20) = {'aux'};
M_.param_names_long(20) = {'aux'};
M_.param_names(21) = {'Ac'};
M_.param_names_tex(21) = {'Ac'};
M_.param_names_long(21) = {'Ac'};
M_.param_names(22) = {'AT'};
M_.param_names_tex(22) = {'AT'};
M_.param_names_long(22) = {'AT'};
M_.param_names(23) = {'std1'};
M_.param_names_tex(23) = {'std1'};
M_.param_names_long(23) = {'std1'};
M_.param_names(24) = {'std2'};
M_.param_names_tex(24) = {'std2'};
M_.param_names_long(24) = {'std2'};
M_.param_partitions = struct();
M_.exo_det_nbr = 0;
M_.exo_nbr = 2;
M_.endo_nbr = 36;
M_.param_nbr = 24;
M_.orig_endo_nbr = 36;
M_.aux_vars = [];
M_ = setup_solvers(M_);
M_.Sigma_e = zeros(2, 2);
M_.Correlation_matrix = eye(2, 2);
M_.H = 0;
M_.Correlation_matrix_ME = 1;
M_.sigma_e_is_diagonal = true;
M_.det_shocks = [];
M_.surprise_shocks = [];
M_.heteroskedastic_shocks.Qvalue_orig = [];
M_.heteroskedastic_shocks.Qscale_orig = [];
options_.linear = false;
options_.block = false;
options_.bytecode = false;
options_.use_dll = false;
M_.orig_eq_nbr = 36;
M_.eq_nbr = 36;
M_.ramsey_eq_nbr = 0;
M_.set_auxiliary_variables = exist(['./+' M_.fname '/set_auxiliary_variables.m'], 'file') == 2;
M_.epilogue_names = {};
M_.epilogue_var_list_ = {};
M_.orig_maximum_endo_lag = 1;
M_.orig_maximum_endo_lead = 1;
M_.orig_maximum_exo_lag = 0;
M_.orig_maximum_exo_lead = 0;
M_.orig_maximum_exo_det_lag = 0;
M_.orig_maximum_exo_det_lead = 0;
M_.orig_maximum_lag = 1;
M_.orig_maximum_lead = 1;
M_.orig_maximum_lag_with_diffs_expanded = 1;
M_.lead_lag_incidence = [
 0 10 0;
 1 11 0;
 2 12 0;
 0 13 0;
 0 14 0;
 0 15 0;
 0 16 0;
 0 17 0;
 0 18 0;
 0 19 0;
 3 20 46;
 4 21 47;
 0 22 48;
 0 23 49;
 5 24 0;
 0 25 0;
 6 26 0;
 0 27 0;
 0 28 0;
 7 29 50;
 0 30 0;
 8 31 0;
 0 32 0;
 0 33 0;
 0 34 0;
 0 35 0;
 0 36 51;
 0 37 0;
 0 38 0;
 0 39 0;
 0 40 0;
 9 41 0;
 0 42 52;
 0 43 0;
 0 44 0;
 0 45 0;]';
M_.nstatic = 23;
M_.nfwrd   = 4;
M_.npred   = 6;
M_.nboth   = 3;
M_.nsfwrd   = 7;
M_.nspred   = 9;
M_.ndynamic   = 13;
M_.dynamic_tmp_nbr = [8; 0; 0; 0; ];
M_.model_local_variables_dynamic_tt_idxs = {
};
M_.equations_tags = {
  1 , 'name' , '1' ;
  2 , 'name' , '2' ;
  3 , 'name' , '3' ;
  4 , 'name' , '4' ;
  5 , 'name' , '5' ;
  6 , 'name' , 'eeh1' ;
  7 , 'name' , 'eeh2' ;
  8 , 'name' , 'eehT' ;
  9 , 'name' , '9' ;
  10 , 'name' , 'pi_c' ;
  11 , 'name' , 'pi' ;
  12 , 'name' , 'y' ;
  13 , 'name' , 'g' ;
  14 , 'name' , 'tau' ;
  15 , 'name' , 'purchases1' ;
  16 , 'name' , 'purchases2' ;
  17 , 'name' , 'g1' ;
  18 , 'name' , 'g2' ;
  19 , 'name' , 'dtaxh' ;
  20 , 'name' , 'db' ;
  21 , 'name' , 'pi_g' ;
  22 , 'name' , 'pi1_g' ;
  23 , 'name' , 'pi2_g' ;
  24 , 'name' , 'federalpurchases' ;
  25 , 'name' , 'pi2' ;
  26 , 'name' , 'ernesto' ;
  27 , 'name' , 'ytest' ;
  28 , 'name' , 'realrate' ;
  29 , 'name' , 'c_output' ;
  30 , 'name' , 'g_output' ;
  31 , 'name' , 'g1ramey' ;
  32 , 'name' , 'g2ramey' ;
  33 , 'name' , 'i_ann' ;
  34 , 'name' , 'mkup1' ;
  35 , 'name' , 'mkup2' ;
  36 , 'name' , 'avmarkup' ;
};
M_.mapping.federalpurchases.eqidx = [24 ];
M_.mapping.purchases1.eqidx = [15 17 24 ];
M_.mapping.purchases2.eqidx = [16 18 24 ];
M_.mapping.avmarkup.eqidx = [36 ];
M_.mapping.g1ramey.eqidx = [31 ];
M_.mapping.g2ramey.eqidx = [32 ];
M_.mapping.mkup1.eqidx = [34 36 ];
M_.mapping.mkup2.eqidx = [35 36 ];
M_.mapping.g1.eqidx = [1 13 17 ];
M_.mapping.g2.eqidx = [2 13 18 ];
M_.mapping.y1.eqidx = [1 3 6 12 22 34 ];
M_.mapping.y2.eqidx = [2 4 7 12 23 35 ];
M_.mapping.pi1.eqidx = [3 10 11 14 28 ];
M_.mapping.pi2.eqidx = [4 10 11 14 25 28 ];
M_.mapping.tau.eqidx = [1 2 3 4 14 26 34 35 ];
M_.mapping.y.eqidx = [12 ];
M_.mapping.g.eqidx = [13 19 20 27 30 ];
M_.mapping.pi.eqidx = [11 ];
M_.mapping.i.eqidx = [5 9 28 33 ];
M_.mapping.c.eqidx = [1 2 3 4 9 22 23 27 29 34 35 ];
M_.mapping.ernesto.eqidx = [26 ];
M_.mapping.p2.eqidx = [25 26 ];
M_.mapping.ytest.eqidx = [27 ];
M_.mapping.realrate.eqidx = [28 ];
M_.mapping.c_output.eqidx = [29 ];
M_.mapping.g_output.eqidx = [30 31 32 ];
M_.mapping.pi_c.eqidx = [5 8 9 10 22 23 ];
M_.mapping.i_ann.eqidx = [33 ];
M_.mapping.eeh1.eqidx = [6 9 ];
M_.mapping.eeh2.eqidx = [7 9 ];
M_.mapping.eehT.eqidx = [8 9 ];
M_.mapping.db.eqidx = [19 20 ];
M_.mapping.dtaxh.eqidx = [8 19 20 ];
M_.mapping.pi_g.eqidx = [19 20 21 ];
M_.mapping.pi1_g.eqidx = [21 22 ];
M_.mapping.pi2_g.eqidx = [21 23 ];
M_.mapping.eps_g1.eqidx = [15 ];
M_.mapping.eps_g2.eqidx = [16 ];
M_.static_and_dynamic_models_differ = false;
M_.has_external_function = false;
M_.state_var = [2 3 11 12 15 17 20 22 32 ];
M_.exo_names_orig_ord = [1:2];
M_.maximum_lag = 1;
M_.maximum_lead = 1;
M_.maximum_endo_lag = 1;
M_.maximum_endo_lead = 1;
oo_.steady_state = zeros(36, 1);
M_.maximum_exo_lag = 0;
M_.maximum_exo_lead = 0;
oo_.exo_steady_state = zeros(2, 1);
M_.params = NaN(24, 1);
M_.endo_trends = struct('deflator', cell(36, 1), 'log_deflator', cell(36, 1), 'growth_factor', cell(36, 1), 'log_growth_factor', cell(36, 1));
M_.NNZDerivatives = [125; -1; -1; ];
M_.static_tmp_nbr = [4; 0; 0; 0; ];
M_.model_local_variables_static_tt_idxs = {
};
M_.params(8) = 4;
varphi = M_.params(8);
M_.params(9) = 0.997;
beta = M_.params(9);
M_.params(7) = 1;
sigma = M_.params(7);
M_.params(10) = 1.5;
phi_pi = M_.params(10);
M_.params(13) = 1;
eta = M_.params(13);
M_.params(14) = 1;
taylor = M_.params(14);
M_.params(23) = .1;
std1 = M_.params(23);
M_.params(24) = .1;
std2 = M_.params(24);
M_.params(5) = .65;
rho_g1 = M_.params(5);
M_.params(6) = .73;
rho_g2 = M_.params(6);
M_.params(11) = .78;
alpha1 = M_.params(11);
M_.params(12) = .89;
alpha2 = M_.params(12);
M_.params(2) = .2;
gy = M_.params(2);
M_.params(3) = 1-M_.params(2);
zeta = M_.params(3);
M_.params(4) = .26;
gamma = M_.params(4);
M_.params(1) = .65;
n = M_.params(1);
M_.params(15) = 0.2;
share = M_.params(15);
M_.params(16) = 1.2;
mu = M_.params(16);
M_.params(18) = .1;
phi_g = M_.params(18);
M_.params(17) = .05;
phi_b = M_.params(17);
M_.params(19) = (M_.params(16)*M_.params(3))^(-1)-1;
a3 = M_.params(19);
M_.params(20) = 1+M_.params(8)+M_.params(19);
aux = M_.params(20);
M_.params(21) = (1+M_.params(8))*(1+M_.params(19))*M_.params(20)^(-1);
Ac = M_.params(21);
M_.params(22) = M_.params(20)^(-1)*M_.params(8)*M_.params(19);
AT = M_.params(22);
%
% SHOCKS instructions
%
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = 1;
M_.Sigma_e(2, 2) = 1;
oo_.dr.eigval = check(M_,options_,oo_);
options_.irf = 25;
options_.nodisplay = true;
options_.nofunctions = true;
options_.order = 1;
options_.periods = 200;
var_list_ = {};
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);


oo_.time = toc(tic0);
disp(['Total computing time : ' dynsec2hms(oo_.time) ]);
if ~exist([M_.dname filesep 'Output'],'dir')
    mkdir(M_.dname,'Output');
end
save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'estimation_info', '-append');
end
if exist('dataset_info', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'dataset_info', '-append');
end
if exist('oo_recursive_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'model_htm_results.mat'], 'oo_recursive_', '-append');
end
if ~isempty(lastwarn)
  disp('Note: warning(s) encountered in MATLAB/Octave code')
end
